<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It is a breeze. Simply tell Lumen the URIs it should respond to
| and give it the Closure to call when that URI is requested.
|
*/
$router->group([
    'namespace' => 'Admin',
    'prefix' => 'course-api/a',
    'middleware' => ['action.record:admin']
    //'middleware' => ['oauth.consumer:admin', 'oauth.scope:admin']
], function() use ($router) {
    // course
    $router->get('/courses', 'CourseController@index');
    $router->post('/courses', 'CourseController@store');
    $router->put('/courses/{courseId}', 'CourseController@update');
    $router->put('/courses/{courseId}/publish', 'CourseController@publish');
    $router->get('/courses/{courseId}', 'CourseController@show');
    $router->delete('/courses/{courseId}', 'CourseController@destroy');

    $router->get('/courses/{courseId}/lessons', 'LessonController@index');
    $router->post('/courses/{courseId}/lessons', 'LessonController@store');
    $router->put('/courses/{courseId}/lessons/{lessonId}', 'LessonController@update');
    $router->put('/courses/{courseId}/lessons-sequence', 'LessonController@sequence');
    $router->get('/courses/{courseId}/lessons/{lessonId}', 'LessonController@show');
    $router->delete('/courses/{courseId}/lessons/{lessonId}', 'LessonController@destroy');

    $router->put('/lessons/{lessonId}/audio', 'LessonController@audio');
    $router->put('/lessons/{lessonId}/cover', 'LessonController@cover');

    $router->put('/lessons/{lessonId}/introduction', 'LessonController@updateIntroduction');
    $router->get('/lessons/{lessonId}/introduction', 'LessonController@getIntroduction');

    $router->get('/lessons/{lessonId}/pages', 'LessonPageController@index');
    $router->post('/lessons/{lessonId}/pages', 'LessonPageController@store');
    $router->put('/lessons/{lessonId}/pages/{pageId}', 'LessonPageController@update');
    $router->put('/lessons/{lessonId}/pages-sequence', 'LessonPageController@sequence');
    $router->get('/lessons/{lessonId}/pages/{pageId}', 'LessonPageController@show');
    $router->delete('/lessons/{lessonId}/pages/{pageId}', 'LessonPageController@destroy');


    $router->get('/lessons/{lessonId}/test-levels', 'LessonTestLevelController@index');
    $router->post('/lessons/{lessonId}/test-levels', 'LessonTestLevelController@store');
    $router->put('/lessons/{lessonId}/test-levels/{levelId}', 'LessonTestLevelController@update');
    $router->delete('/lessons/{lessonId}/test-levels/{levelId}', 'LessonTestLevelController@destroy');


    $router->get('/lessons/{lessonId}/tests', 'LessonTestController@index');
    $router->post('/lessons/{lessonId}/tests', 'LessonTestController@store');
    $router->put('/lessons/{lessonId}/tests/{testId}', 'LessonTestController@update');
    $router->get('/lessons/{lessonId}/tests/{testId}', 'LessonTestController@show');
    $router->delete('/lessons/{lessonId}/tests/{testId}', 'LessonTestController@destroy');
    $router->put('/lessons/{lessonId}/tests-sequence', 'LessonTestController@sequence');

    $router->get('/lessons/{lessonId}/knowledge', 'LessonTestController@knowledge');


    $router->put('/lessons/{lessonId}/publish', 'LessonVersionController@publish');

    $router->get('/tags', 'TagController@index');
    $router->post('/tags', 'TagController@store');
    $router->put('/tags/{tagId}', 'TagController@update');
    $router->delete('/tags/{tagId}', 'TagController@destroy');

    $router->get('/attachments', 'AttachmentController@index');
    $router->post('/attachments', 'AttachmentController@store');
    $router->put('/attachments/{attachmentId}', 'AttachmentController@update');
    $router->delete('/attachments/{attachmentId}', 'AttachmentController@destroy');

    $router->get('/test-templates', 'TemplateController@index');
    $router->put('/test-templates/{templateId}', 'TemplateController@update');

    $router->get('/knowledge', 'KnowledgeController@index');
    $router->post('/knowledge', 'KnowledgeController@store');
    $router->put('/knowledge/{knowledgeId}', 'KnowledgeController@update');
    $router->put('/knowledge/{knowledgeId}/audio', 'KnowledgeController@audio');
    $router->put('/knowledge/{knowledgeId}/images', 'KnowledgeController@images');
    $router->get('/knowledge/{knowledgeId}', 'KnowledgeController@show');
    $router->delete('/knowledge/{knowledgeId}', 'KnowledgeController@destroy');

    $router->put('/knowledge/{knowledgeId}/tags', 'KnowledgeController@tags');

    $router->get('/assist-word', 'AssistWordController@index');
    $router->post('/assist-word', 'AssistWordController@store');
    $router->put('/assist-word/{wordId}', 'AssistWordController@update');
    $router->get('/assist-word/{wordId}', 'AssistWordController@show');
    $router->delete('/assist-word/{wordId}', 'AssistWordController@destroy');



    $router->get('/levels', 'LevelController@index');
    $router->post('/levels', 'LevelController@store');
    $router->put('/levels/{levelId}', 'LevelController@update');
    $router->delete('/levels/{levelId}', 'LevelController@destroy');

    $router->get('/level-words', 'LevelWordController@index');
    $router->post('/level-words', 'LevelWordController@store');
    $router->put('/level-words/{wordId}', 'LevelWordController@update');
    $router->delete('/level-words/{wordId}', 'LevelWordController@destroy');

    $router->get('/guides', 'GuideController@index');
    $router->post('/guides', 'GuideController@store');
    $router->put('/guides/{guideId}', 'GuideController@update');
    $router->delete('/guides/{guideId}', 'GuideController@destroy');
    $router->put('/guides/{guideId}/pages-sequence', 'GuideController@sequence');
    $router->put('/guides/{guideId}/publish', 'GuideController@publish');


    $router->get('/guides/{guideId}/pages', 'GuidePageController@index');
    $router->post('/guides/{guideId}/pages', 'GuidePageController@store');
    $router->get('/guides/{guideId}/pages/{pageId}', 'GuidePageController@show');
    $router->put('/guides/{guideId}/pages/{pageId}', 'GuidePageController@update');
    $router->delete('/guides/{guideId}/pages/{pageId}', 'GuidePageController@destroy');
});

